Free the translate queue when closing a display
authorMatthias Clasen <mclasen@redhat.com>
Sat, 9 Apr 2011 01:34:25 +0000 (21:34 -0400)
committerMatthias Clasen <mclasen@redhat.com>
Sat, 9 Apr 2011 01:34:25 +0000 (21:34 -0400)
Not that many people are ever going to hit this.
https://bugzilla.gnome.org/show_bug.cgi?id=645236

gdk/x11/gdkdisplay-x11.c
gdk/x11/gdkgeometry-x11.c
gdk/x11/gdkprivate-x11.h

index c4d776381af84f768cdd0ccef0b64514c2abbfb6..575c68d1c3a843846e5515457e69f67704bebfb9 100644 (file)
@@ -1729,6 +1729,9 @@ gdk_x11_display_finalize (GObject *object)
 
   _gdk_x11_cursor_display_finalize (GDK_DISPLAY (display_x11));
 
+  /* Empty the event queue */
+  _gdk_x11_display_free_translate_queue (GDK_DISPLAY (display_x11));
+
   /* Atom Hashtable */
   g_hash_table_destroy (display_x11->atom_from_virtual);
   g_hash_table_destroy (display_x11->atom_to_virtual);
index 580183bf5ca3ef06b4f494061b65aa0a85fb3bc8..05bda6c6d083e32e89bc316150259ec419714d63 100644 (file)
@@ -153,6 +153,19 @@ queue_item_free (GdkWindowQueueItem *item)
   g_free (item);
 }
 
+void
+_gdk_x11_display_free_translate_queue (GdkDisplay *display)
+{
+  GdkX11Display *display_x11 = GDK_X11_DISPLAY (display);
+
+  if (display_x11->translate_queue)
+    {
+      g_queue_foreach (display_x11->translate_queue, (GFunc)queue_item_free, NULL);
+      g_queue_free (display_x11->translate_queue);
+      display_x11->translate_queue = NULL;
+    }
+}
+
 static void
 gdk_window_queue (GdkWindow          *window,
                  GdkWindowQueueItem *item)
index 2df20583c5e84e5b962661279c685bc7f045cc60..52ff852d5809b41f9059b237f484c2778c87e2a5 100644 (file)
@@ -138,6 +138,8 @@ void     _gdk_x11_window_translate         (GdkWindow *window,
                                             gint       dx,
                                             gint       dy);
 
+void     _gdk_x11_display_free_translate_queue (GdkDisplay *display);
+
 void     _gdk_x11_selection_window_destroyed   (GdkWindow            *window);
 gboolean _gdk_x11_selection_filter_clear_event (XSelectionClearEvent *event);